package logicGame.States;

import java.io.Serializable;
import logicGame.Board;
import logicGame.Cards.AndCard;
import logicGame.Cards.Card;
import logicGame.Game;
import logicGame.Player;

public class PickArmy extends StateAdapter implements Serializable {

    public PickArmy(Game g) {
        super(g);
    }

    @Override
    public State chooseArmy(Player p, Board b, int f) {
        Card c = getGame().getActivePlayer().getLastCard();
        
        c.DoAction(p, b, -1, f);
        getGame().setPlace(-1);
        
        if (c instanceof AndCard) {
            if (c.getTimes() < 2) {
                return back();
            }
        }

        return proxPlayer();
    }

    @Override
    public State back() {
        return new And(getGame());
    }

}
